import os
import pytest
from tools.read_excel_range_as_list_of_dictionary import read_excel_range_as_list_of_dictionary
from tools.map_list_of_dictionary import map_list_of_dictionary

@pytest.mark.parametrize("input_range, mapping_dictonary,expected_keys,expected_rows", [
    ("A10:B12",{"clazz_name":"A","course_name":"B"},['A','B','clazz_name','course_name'],3),

])
def test_map_list_of_dictionary(input_range,mapping_dictonary, expected_keys,expected_rows):
    file_path = "tools/read_excel_range_as_list_of_dictionary_test_data.xlsx"
    sheet_name = "TestSheet"
    result = read_excel_range_as_list_of_dictionary(file_path, sheet_name,input_range)
    map_list_of_dictionary(result,mapping_dictonary)
    assert list(result[0].keys()) == expected_keys
    assert len(result) == expected_rows

